unit SmallStruct.Configuration.TSSConfigurationTable;

interface

uses Classes,
  SmallStruct.Core,
  SmallStruct.Core.TSSObjectFactory,
  SmallStruct.Configuration;

type
  TSSConfigurationTable = class(TSSObjectFactory, ISSConfigurationTable)
  private
    function GetConfigurationLoader: ISSConfigurationLoader;
  private
    function QueryActionConfiguration(const AActionName: string): ISSConfiguration;
    function QueryActionViewConfiguration(const AActionViewName: string): ISSConfiguration;
    function QueryBusinessObjectConfiguration(const ABusinessObjectName: string): ISSConfiguration;
    function QueryDatabaseConnectionConfiguration: ISSObjectContainer; overload;
    function QueryDatabaseConnectionConfiguration(const ADatabaseConnectionName: string): ISSConfiguration; overload;
    function QueryModelConfiguration(const AModelName: string): ISSConfiguration;
    function QueryViewConfiguration(const AViewName: string): ISSConfiguration;
  end;

implementation

{ TSSConfigurationTable }

function TSSConfigurationTable.GetConfigurationLoader: ISSConfigurationLoader;
begin
  Result := (GetSystemObject.GetGlobalObjectTable as ISSObjectContainer).GetObject(SS_CONFIGURATION_LOADER) as ISSConfigurationLoader
end;

function TSSConfigurationTable.QueryActionConfiguration(const AActionName: string): ISSConfiguration;
begin
  Result := GetConfigurationLoader.LoadActionConfiguration(AActionName);
end;

function TSSConfigurationTable.QueryActionViewConfiguration(const AActionViewName: string): ISSConfiguration;
begin
  Result := GetConfigurationLoader.LoadActionViewConfiguration(AActionViewName);
end;

function TSSConfigurationTable.QueryBusinessObjectConfiguration(const ABusinessObjectName: string): ISSConfiguration;
begin
  Result := GetConfigurationLoader.LoadBusinessObjectConfiguration(ABusinessObjectName)
end;

function TSSConfigurationTable.QueryDatabaseConnectionConfiguration(const ADatabaseConnectionName: string): ISSConfiguration;
begin
  Result := GetConfigurationLoader.LoadDatabaseConnectionConfiguration(ADatabaseConnectionName);
end;

function TSSConfigurationTable.QueryDatabaseConnectionConfiguration: ISSObjectContainer;
begin
  Result := GetConfigurationLoader.LoadDatabaseConnectionConfiguration;
end;

function TSSConfigurationTable.QueryModelConfiguration(const AModelName: string): ISSConfiguration;
begin
  Result := GetConfigurationLoader.LoadModelConfiguration(AModelName);
end;

function TSSConfigurationTable.QueryViewConfiguration(const AViewName: string): ISSConfiguration;
begin
  Result := GetConfigurationLoader.LoadViewConfiguration(AViewName);
end;

end.
